package ui.frame.dialog;

import static constants.GTextbookConstants.Category;

import java.awt.event.ActionEvent;

import ui.Utility;
import ui.frame.GTFrame;
import ui.frame.GTextbook;
import ui.frame.dialog.dialogInterface.modifyDialog;
import ui.view.NodeInfo;
import ui.view.GTView;
import ui.view.IndexTreeNode;
import ui.view.IndexTreeView;

public class ModifyCategoryDialog extends CategoryDialog implements modifyDialog{
	

	public ModifyCategoryDialog(IndexTreeNode node,GTextbook theApp, int language){
		super(theApp, language);
		this.node = node;
	}
	
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource() == cancel){
			this.dispose();
		}
		if(e.getSource() == ok){
		
		    //do the modifying job
			if(Utility.removeFromKB(((NodeInfo)(node.getUserObject())).getKnowledgeID(), "Category")){
				if(store("Category")){
					//modify the node
					if(modifyView(node)){
						this.dispose();	
					}	
				}
			}
		}
	}
	
	private IndexTreeNode node;

	public IndexTreeNode getNode() {
		// TODO Auto-generated method stub
		return node;
	}


}
